---
title: "Recusal Paper Analysis"
output:
  word_document: default
  html_document: default
---


# Replication code for Tables 1 and 2

```{r}
library(tidyverse)
library(Zelig)
library(texreg)

```

```{r}

my_data <- rio::import("~/Recusal Database.dta")

```

Independent variables:

- mwc: minimal winning coalition, binary, 1, yes, 0, no
- diss: dissent on the lower court, binary, 1, yes, 0, no
- uncon: declaration of unconstitutionality, categorical, 0, no declaration, 1, act of congress unconstitutional, 2, state law unconstitutional, 3 municipal law unconstitutional (we tried also a binary version of this variable, it does not change the magnitude or significance of mwc)
- alt_prec: alteration of precedent, binary, 1, yes, 0, no
- laws: case with multiple legal provisions, 1, yes, 0, no



```{r}

# Table 1
# health recusal

z.out1 <- zelig(healthrec ~ mwc + diss + uncon + alt_prec + laws,
                data = my_data, model = "relogit")

summary(z.out1)
```


```{r}

# Table 1
# discretionary recusal

z.out2 <- zelig(recusal ~ mwc + diss + uncon + alt_prec + laws, data = my_data, model = "relogit")
summary(z.out2)
```

# Table 2
# separate natural courts

```{r}

# Vinson Court

z.out3 <- zelig(recusal ~ mwc + diss + uncon + alt_prec + laws,
              data = filter(my_data, natct2==1), model = "relogit")
summary(z.out3) # does not converge for Vinson Court
```

```{r}

# Warren Court

z.out4 <- zelig(recusal ~ mwc + diss + uncon + alt_prec + laws,
              data = filter(my_data, natct2==2), model = "relogit")
summary(z.out4)
```


```{r}

# Burger Court

z.out5 <- zelig(recusal ~ mwc + diss + uncon + alt_prec + laws,
              data = filter(my_data, natct2==3), model = "relogit")
summary(z.out5)
```

```{r}

# Rehnquist Court

z.out6 <- zelig(recusal ~ mwc + diss + uncon + alt_prec + laws,
              data = filter(my_data, natct2==4), model = "relogit")
summary(z.out6)

```


```{r}
texreg(list(z.out1,z.out2,z.out4,z.out5,z.out6), caption = "Health and Discretionary Recusal on the Supreme Court",custom.coef.names=c("Intercept","Minimum Winning Coalition","Lower Court Dissent","Constitutional Case","Alteration of Precedent","Multiple Legal Provisions"),custom.model.names = c("Health Recusal","Discretionary Recusal","Warren","Burger","Rehnquist"))
```


```{r}
screenreg(list(z.out1,z.out2,z.out4,z.out5,z.out6), caption = "Health and Discretionary Recusal on the Supreme Court",custom.coef.names=c("Intercept","Minimum Winning Coalition","Lower Court Dissent","Constitutional Case","Alteration of Precedent","Multiple Legal Provisions"),custom.model.names = c("Health Recusal","Discretionary Recusal","Warren","Burger","Rehnquist"))
```
